package com.mingyuan.library.domain.lending.patron.model.valueobject;

import com.mingyuan.library.domain.common.model.ValueObject;
import lombok.Value;

/**
 * 天数
 */
@Value
@ValueObject
public class NumberOfDays {
    /**
     * 天数
     */
    int days;

    private NumberOfDays(int days) {
        if(days <= 0) {
            throw new IllegalArgumentException("Cannot use negative integer or zero as number of days");
        }
        this.days = days;
    }
    /**
     * 借多少天
     * @author yangzk
     * @param days 天数
     * @date 2023/12/28 18:22
     **/
    public static NumberOfDays of(int days) {
        return new NumberOfDays(days);
    }

    boolean isGreaterThan(int days) {
        return this.days > days;
    }
}
